import { createRouter, createWebHistory } from "vue-router";
import Layout from "@/views/LayuotView.vue"; // 修正文件名拼写
import Login from "@/views/loginView.vue"; // 组件名首字母大写
import ProductAddview from "@/views/ProductAddview.vue";
import ProductListview from "@/views/ProductListview.vue";
import CarouselAdd from "@/views/carouselAdd.vue";
import CarouselList from "@/views/carouselList.vue";
import HomeView from "@/views/HomeView.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "Layout",
      component: Layout,
      redirect: "/home",
      children: [
        {
          path: "home",
          name: "home",
          component: HomeView,
        },
        {
          path: "proadd",
          name: "proadd",
          component: ProductAddview,
        },
        {
          path: "prolist",
          name: "prolist",
          component: ProductListview,
        },
        {
          path: "CarouselAdd",
          name: "CarouselAdd",
          component: CarouselAdd,
        },
        {
          path: "CarouselList",
          name: "CarouselList",
          component: CarouselList,
        },
      ],
    },
    {
      path: "/login",
      name: "Login",
      component: Login,
    },
  ],
});

export default router;
